package cn.yuanqiao.archive.liyong.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.core.domain.model.LoginUser;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 我的订阅对象 YQDY
 * 
 * @author sy
 * @date 2023-08-10
 */
public class YqDy extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    private final String BIGTABLENAME = "_YQDY";

    public YqDy() {
        try{
            String userCode = SecurityUtils.getTenantCode();
            if(StringUtils.isEmpty(userCode)){
//            throw new ServiceException("TenantCode is null");
                this.tableName = "YQDY";
            }else {
                this.tableName = userCode.toUpperCase()+BIGTABLENAME;
//            this.tableName = "YQDY";
            }
        }catch (Exception e){
            this.tableName = "YQDY";
        }
    }

    public YqDy(String tenantCode) {
        if(StringUtils.isEmpty(tenantCode)){
//            throw new ServiceException("TenantCode is null");
            this.tableName = "YQDY";
        }else {
            this.tableName = tenantCode.toUpperCase()+BIGTABLENAME;
//            this.tenantCode = tenantCode;
//            this.tableName = "YQDY";
        }
    }

    private String tableName;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    private String tenantCode;

    public String getTenantCode() {
        return tenantCode;
    }

    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }

    /** 订阅ID */
    private Long dyId;

    /** 关键词 */
    @Excel(name = "关键词")
    private String gjc;

    /** 待读消息数目 */
    @Excel(name = "待读消息数目")
    private Integer xxsm;

    /** 最新消息时间（对应YQDY_DA表最新的添加时间） */
    @Excel(name = "最新消息时间", readConverterExp = "对应YQDY_DA表最新的添加时间")
    private Date zxsj;

    /** 创建人 */
    @Excel(name = "创建人")
    private Long creatorId;

    /** 归档处室ID */
    @Excel(name = "归档处室ID")
    private Long gdcsId;

    public void setDyId(Long dyId) 
    {
        this.dyId = dyId;
    }

    public Long getDyId() 
    {
        return dyId;
    }
    public void setGjc(String gjc) 
    {
        this.gjc = gjc;
    }

    public String getGjc() 
    {
        return gjc;
    }
    public void setXxsm(Integer xxsm) 
    {
        this.xxsm = xxsm;
    }

    public Integer getXxsm() 
    {
        return xxsm;
    }
    public void setZxsj(Date zxsj) 
    {
        this.zxsj = zxsj;
    }

    public Date getZxsj() 
    {
        return zxsj;
    }
    public void setCreatorId(Long creatorId) 
    {
        this.creatorId = creatorId;
    }

    public Long getCreatorId() 
    {
        return creatorId;
    }

    public Long getGdcsId() {
        return gdcsId;
    }

    public void setGdcsId(Long gdcsId) {
        this.gdcsId = gdcsId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("dyId", getDyId())
            .append("gjc", getGjc())
            .append("xxsm", getXxsm())
            .append("zxsj", getZxsj())
            .append("creatorId", getCreatorId())
            .append("createTime", getCreateTime())
            .append("remark", getRemark())
            .append("gdcsId", getGdcsId())
            .toString();
    }
}
